// 订单管理API - 简化版本，方便修改
import { request } from '@/utils/request'

/**
 * 订单管理API
 * 可以直接修改参数和请求地址
 */
export const orderAPI = {
  
  // 获取订单列表
  // 参数：{ pageSize: 10, currentPage: 1, orderId: '', orderName: '', ... }
  // 返回：{ code: 200, msg: '成功', data: { list: [], total: 0 } }
  getList: (params: any) => {
    return request.post('/dragon/orderListBak', params)
  },

  // 获取订单总数
  getListCount: (params: any) => {
    return request.post('/dragon/orderCountBak', params)
  },

  // 通过商品ID查询商品信息
  getProductInfoById: (params: any) => {
    return request.post('/dragon/getProductInfoById', params)
  },

  // 通过用户ID 或者 账号名 或者 用户电话 获取用户信息
  getUserInfoByIdOrNameOrTel: (params: any) => {
    return request.post('/dragon/getUserInfoByIdOrNameOrTel', params)
  },

  // 更新处理状态
  updateOrderType: (params: any) => {
    return request.post('/dragon/updateOrderType', params)
  },

  // 后台新增订单
  orderCreateBak: (params: any) => {
    return request.post('/dragon/orderCreateBak', params)
  },

  // 后台修改订单
  orderUpdateBak: (params: any) => {
    return request.post('/dragon/orderUpdateBak', params)
  },

  // 后台删除订单
  deleteOrderByIdBak: (params: any) => {
    return request.post('/dragon/deleteOrderByIdBak', params)
  },
  







  // 创建订单
  // 参数：{ orderName: '订单名称', orderTotal: 1, ... }
  create: (params: any) => {
    return request.post('/dragon/orderCreate', params)
  },
  
  // 更新订单
  // 参数：{ id: 1, orderName: '新订单名称', ... }
  update: (params: any) => {
    return request.post('/dragon/orderUpdate', params)
  },
  
  // 删除订单
  // 参数：{ id: 1 }
  delete: (params: any) => {
    return request.post('/dragon/orderDelete', params)
  },
  
  // 获取订单详情
  // 参数：{ id: 1 }
  getDetail: (params: any) => {
    return request.post('/api/orderDetail', params)
  },
  
  // 批量删除订单
  // 参数：{ ids: [1, 2, 3] }
  batchDelete: (params: any) => {
    return request.post('/api/orderBatchDelete', params)
  },
  
  // 导出订单
  // 参数：{ ... }
  export: (params: any) => {
    return request.post('/api/orderExport', params)
  }
}

export default orderAPI 